import { LoginForm, ReqGetUserInfo } from "@/types/user";
import request from "@/utils/request";

// 获取验证码
export const reqSendCode = (mobile: string) => request({
    method: 'get',
    url: `/v1_0/sms/codes/${mobile}`
})
// 登录
export const reqLogin = (data: LoginForm) => request({
    method: 'POST',
    url: '/v1_0/authorizations',
    data
})
// 获得用户个人资料
export const reqGetUserInfo = () => request.get<ReqGetUserInfo>('v1_0/user/profile')
//  获取用户自己本人信息
export const reqGetUserInfoMsg = () => request.get('v1_0/user')
// 编辑用户照片资料
export const reqUpdatePhoto = (photo: FormData) => request.patch('/v1_0/user/photo', photo)
// 更新用户资料
export const reqUpdateUser = (data: {
    name?: string,
    gender?: number,
    birthday?: string,
    intro?: string,
}) => request.patch('v1_0/user/profile', data)
// 关注用户
export const reqSetFocus = (target: string) => request.post('/v1_0/user/followings', { target })
// 取消关注
export const reqDelFocus = (target: string) => request.delete(`/v1_0/user/followings/${target}`)